﻿@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{

}
<link href='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.8/index.min.css' rel='stylesheet' />
<script src='https://cdn.jsdelivr.net/npm/fullcalendar@6.1.8/index.min.js'></script>



<div id='calendar'></div>
<script>
    document.addEventListener('DOMContentLoaded', function () {
        var calendarEl = document.getElementById('calendar');
        var tasks = @Html.Raw(Json.Serialize(Model));
        var calendar = new FullCalendar.Calendar(calendarEl, {
            initialView: 'dayGridMonth',
            events: tasks.map(function (task) {
                return {
                    title: task.Title,
                    start: task.Start,
                    end: task.End
                };
            })
        });
        calendar.render();
    });
</script>